﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Create.ascx.vb" Inherits="Control_Menu_Create" %>
<%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
<script type="text/javascript">

    function ajaxJquery() {

        $(function () {
            //Upload Image
            $('#file_upload').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/UploadProduct.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': false,
                'fileExt': '*.jpg;*.gif;*.png;*.jpeg;*.bmp',
                'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG , .JPEG , .BMP)',
                'fileDataName': 'myfile',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onComplete': function (event, ID, fileObj, response, data) {
                    $('#<%=hidImagePath.ClientID %>').val('<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);
                    $('#<%=imgUpload.ClientID %>').attr("src", '<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);
                }
            });
            //file_upload_content
            var str = "";
            //Upload Album 
            $('#file_upload_content').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/UploadAlbum.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': true,
                'fileExt': '*.jpg;*.gif;*.png;*.jpeg;*.bmp',
                'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG , .JPEG , .BMP)',
                'fileDataName': 'fileAlbum',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onComplete': function (event, ID, fileObj, response, data) {
                    str += '<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response;
                },
                'onAllComplete': function (event, data) {
                    str += "0";
                    var myAlbum = new Array();
                    myAlbum = str.split(",");
                    str = "";
                    for (var i = 0; i < myAlbum.length - 1; i++) {
                        $("#<%= txtDescription.ClientID %>").find('iframe').contents().find('body').append("<p align='center'><img alt=''  src='" + myAlbum[i] + "' /></p><p  align='center'>Mô tả ảnh</p>");
                    }
                }
            });
        });
    }
</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="BoxField">
    <div class="HeadTitle">
        <h3>
            THÊM MENU
        </h3>
    </div>
    <div class="DivRequired">
        <span class="fieldRequired">&nbsp;</span>Trường yêu cầu nhập dữ liệu
    </div>
    <div class="Error">
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="#FF3300" />
    </div>
    <div class="DivRow">
        <div class="DivLabel">
            <asp:Label ID="lblTitle" CssClass="TextLabel" runat="server" Text="Tiêu đề" />
            <span class="fieldRequired">&nbsp;</span>
        </div>
        <div class="DivTextBox">
            <asp:TextBox ID="txtTitle" CssClass="TextBox" runat="server" Text="" />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTitle"
                Display="None" ErrorMessage="Vui lòng nhập tiêu đề."></asp:RequiredFieldValidator>
        </div>
    </div>
    <div class="DivRow">
        <div class="DivLabel">
            <asp:Label ID="Label1" CssClass="TextLabel" runat="server" Text="Meta tiêu đề" />            
        </div>
        <div class="DivTextBox">
            <asp:TextBox ID="txtMetaTitle" CssClass="TextBox" runat="server"  Text="" />            
        </div>
    </div>
    <div class="DivRow">
                <div class="DivLabel">
                    <asp:Label ID="Label2" CssClass="TextLabel" runat="server" Text="Ảnh đại diện:" />
                </div>
                <div class="DivTextBox">
                    <input id="file_upload" name="file_upload" type="file" /><a id="upload" href="javascript:$('#file_upload').uploadifyUpload();">Upload
                        Files</a>
                </div>
            </div>
            <div class="DivRow">
                <div class="DivLabel">
                    &nbsp;</div>
                <div style="height: 100px;" class="DivTextBox">
                    <asp:Image ID="imgUpload" runat="server" BorderWidth="0px" Height="100px" Width="100px"
                        ImageUrl="~/images/NoPhotoAvailable.jpg" />
                </div>
            </div>
          <div class="DivRow">
                <div class="DivLabel">
                    <asp:Label ID="Label3" CssClass="TextLabel" runat="server" Text="Ảnh nội dung:" />
                </div>
                <div class="DivTextBox">
                    <input id="file_upload_content" name="file_upload_content" type="file" />
                    <a id="uploadupd" href="javascript:$('#file_upload_content').uploadifyUpload();">Upload
                        Files</a>
                </div>
            </div>
            <div class="DivRow">
                <div class="DivLabel">
                    <asp:Label ID="lblContent" CssClass="TextLabel" runat="server" Text="Nội dung:" />
                </div>
            </div>
             <div class="DivRow">
                <div class="DivTextBox">
                    <CE:Editor ID="txtDescription" runat="server" Width="100%" Height="500" EditorWysiwygModeCss="~/example.css">
                        <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
                            CssClass="CuteEditorFrame" Height="100%" Width="100%" />
                    </CE:Editor>
                </div>
            </div>
    
<div class="DivRow">
        <div class="DivLabel">
            <asp:Label ID="lblMenuposition" CssClass="TextLabel" runat="server" Text="Vị trí:" />
            <span class="fieldRequired">&nbsp;</span></div>
        
    </div>
<div class="DivTextBox">
            <asp:DropDownList ID="drlMenuposition" Width="163px"  CssClass="TextBox"
                runat="server">
                <asp:ListItem Value=""> ----Chọn ----- </asp:ListItem>
                <asp:ListItem Value="1">Trên Menu </asp:ListItem>
                <asp:ListItem Value="2">Không </asp:ListItem>
                
            </asp:DropDownList>
            <span class="fieldRequired"><asp:RequiredFieldValidator ID="RequiredFieldValidator4"
                runat="server" ControlToValidate="drlMenuposition" Display="None" ErrorMessage="Vui lòng chọn vị trí."
                >*</asp:RequiredFieldValidator>
            </span>
        </div>
    
    
    <div class="DivRow">
        <div class="DivLabel">
            &nbsp;&nbsp;&nbsp;</div>
        <div class="DivTextBox">
            <asp:Button ID="btnSave" runat="server" Text=" Lưu " CssClass="btn" />
            <asp:Button ID="btnHuy" CausesValidation="false" runat="server" Text=" Hủy " CssClass="btn" />
        </div>
    </div>
</div>
<div style="display: none">
    <asp:HiddenField ID="hidID" Value="0" runat="server" />
    <asp:TextBox ID="hidImagePath" Text="" runat="server" />
</div>


</ContentTemplate>
</asp:UpdatePanel>

